package model;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

public class MaskinTypeTest
{
	private MaskinType maskinType;
	private Maskine maskine;
	private Tegning tegning;

	@Before
	public void setUp() throws Exception
	{
		maskinType = new MaskinType("BoreMaskine");
		maskine = new Maskine("Gildemeister", 101, maskinType);
		tegning = new Tegning(01);
		maskinType.addMaskine(maskine);
		maskinType.addTegning(tegning);
	}

	@Test
	public void testAddTegning()
	{
		assertTrue(maskinType.getTegninger().contains(tegning));
		assertSame(tegning.getMaskinType(),maskinType);
	}
	
	@Test
	public void testRemoveTegning()
	{
		maskinType.removeTegning(tegning);
		assertFalse(maskinType.getTegninger().contains(tegning));
	}

	@Test
	public void testAddMaskine()
	{
		assertTrue(maskinType.getMaskiner().contains(maskine));
		assertSame(maskine.getMaskinType(), maskinType);
	}

	@Test
	public void testRemoveMaskine()
	{
		maskinType.removeMaskine(maskine);
		assertFalse(maskinType.getMaskiner().contains(maskine));
	}

}
